from base.request_new import RequestNew


class BuyProduct:

    def __init__(self, cookies):
        self.rt = RequestNew(cookie=cookies)

    def buy_product_pack_by_h5(self, product_pack_id, material_version=""):
        req = {
            "url": "",
            "data": {
            },
            "method": "POST",
            "return_order_id": "$.data.orderId",
        }
        try:
            res = self.rt.request_auto(**req)
        except RuntimeError:
            return None, {"Msg": f"商品包{product_pack_id}已购买"}
        return res
